package com.area.mapper;

import com.area.entity.Producttype;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口 分类管理
 * </p>
 *
 * @author guanfenga@yonyou.com
 * @since 2023-01-09
 */
public interface ProducttypeMapper extends BaseMapper<Producttype> {

    String columns = "`productTypeId`, `sortName`, `sortCode`, `parentId`, `isShow`, `isRecommend`, `categoryImage`, `categoryDescription`, `loadType`, `level`, `industrySpecific`, `itemId`, `sameRule`, `isDesignated`" +
            ", `designatedET`, `buyType`, `competebmFlag`, `cansd`, `cannotPack`, `userAreaStateParam`";

    @Select("select "+columns+" from mall_producttype ")
    List<Producttype> queryProductTypeAll(Producttype producttype);

    @Select("select "+columns+" from mall_producttype p where p.parentId = #{parentId}")
    List<Producttype> queryProductTypeParentId(@Param("parentId") Integer parentId);

    @Select("select "+columns+" from mall_producttype p where p.productTypeId = #{productTypeId}")
    Producttype queryProductTypeId(@Param("productTypeId") Integer productTypeId);
}
